package com.api.oa.mapper;

import com.api.oa.model.entity.YQCase;
import com.api.oa.model.vo.OaNoticeVo;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface YQCaseMapper {

    @Insert("insert into  yq_case  (" +
        "caseId," +
        "requestOrder," +
        "caseUrl," +
        "createdAt" +
    ") " +
    "values " +
    "(" +
        "#{entity.caseId}," +
        "#{entity.requestOrder}," +
        "#{entity.caseUrl}," +
        "#{entity.createdAt}" +
    ")" )
    @Options(useGeneratedKeys = true, keyProperty = "caseId", keyColumn = "id")
    Integer insert(@Param("entity") YQCase entity);



    @Update("update  yq_case  set " +
        "caseId = #{entity.caseId}," +
        "requestOrder = #{entity.requestOrder}," +
        "caseUrl = #{entity.caseUrl}," +
        "createdAt = #{entity.createdAt}" +
    " where caseId = #{entity.caseId}")
    Integer update(@Param("entity") YQCase  entity);


    @Delete("delete from yq_case where caseId=#{id}")
    void delete(@Param("id") Long id);


    @Select("<script>select * from  yq_case </script>")
    List<YQCase> list(@Param("id") String pid);


    @Select("<script>select * from  yq_case where requestOrder = #{id}  </script>")
    List<YQCase> listByOrder(@Param("id") String pid);


    @Select("select * from  yq_case  where caseId = #{id} limit 1")
    YQCase findOne(@Param("id") Long id);

}

